<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class user extends Array{
            constructor(...args){
                super(...args);// new Array() 实现了数组的构造方法，[...args]
                
              }  //可以省略,因为继承了Array内置类，自动实现了super()
             first(){
                 return this[0];
             }
             max(){
                  return  this.sort((a,b)=>b-a)[0];
             }
        }
        let u = new user(12,123,4,48);
        console.log(u.first());
        console.log(u.max());

  

    </script>
</body>
</html>